package com.example.springboot_demo_redis_annotation_token.controller;

import com.example.springboot_demo_redis_annotation_token.common.ServerResponse;
import com.example.springboot_demo_redis_annotation_token.service.TokenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TokenController {

    @Autowired
    private TokenService tokenService;

    @RequestMapping("/getToken")
    public ServerResponse getToken() {
        ServerResponse serverResponse = tokenService.createToken();
        log.info(serverResponse.toString());
        return serverResponse;
    }

}
